<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>File</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit|ie-comp|ie-stand" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <style>
        #show{
            text-align: center;
        }
        img{
            max-width: 100%;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div id="show"></div>
<script>
    //alert(args("name"));
    window.onload=function () {
       var file = args("name");
       var imgs =[".png",".jpg",".jpeg",".gif",".bmp",".ico"];
       var imgf = false;
       for(i=0;i<imgs.length;i++){
           if(file.indexOf(imgs[i])>0){
               imgf = true;
           }
       }
        if(imgf){
            document.getElementById("show").innerHTML="<a onclick=\"window.open('"+file+"');\"><img src='"+file+"'></a>";
        }else{
            window.location.href=file;
        }
    };
    function args(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
</script>
</body>
</html>